package buildings.iterators;

import buildings.dwelling.DwellingFloor;
import buildings.Space;
import java.util.Iterator;

public class DwellingFloorIterator implements Iterator {

    private DwellingFloor floor;
    private int count;

    public DwellingFloorIterator(DwellingFloor df) {
        floor = df;
        count = 0;
    }

    public Space next() {
        return floor.getSpaceByNumber(count++);
    }

    public boolean hasNext() {
        return floor.getSpaceCount() < count;
    }

    public void remove() throws UnsupportedOperationException {
        throw new UnsupportedOperationException();
    }
}
